#include <fermat/dio/file_base.h>
#include <fermat/dio/request.h>
#include <fermat/dio/serving_request.h>

#include <iomanip>

namespace fermat {

ServingRequest::ServingRequest(
    const CompletionHandler& on_cmpl,
    const FileBasePtr& pfile,
    void* pbuffer, offset_type off_set, size_type len,
    ReadOrWriteType rwtype)
    : Request(on_cmpl, pfile, pbuffer, off_set, len, rwtype) {

}

void ServingRequest::serve() {
    check_nref();
    int ret = _file->serve(_buffer, _offset, _bytes, _type);
    check_nref(true);
    completed(ret, false);
}

}

